package com.lqq.biz.impl;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.lqq.biz.NewsinfoBiz;
import com.lqq.dao.NewsinfoDAO;
import com.lqq.entity.Newsinfo;
import com.lqq.entity.Pager;

@Transactional
public class NewsinfoBizImpl implements NewsinfoBiz {

	NewsinfoDAO newsinfoDAO;
	
	public void setNewsinfoDAO(NewsinfoDAO newsinfoDAO) {
		this.newsinfoDAO = newsinfoDAO;
	}

	@Override
	public List<Newsinfo> getAllNewsinfoByPage(int curPage, int pageSize) {
		// TODO Auto-generated method stub
		return newsinfoDAO.getAllNewsinfoByPage(curPage, pageSize);
	}

	@Override
	public Integer getCountOfAllNewsinfo() {
		// TODO Auto-generated method stub
		return newsinfoDAO.getCountOfAllNewsinfo();
	}

	@Override
	public List<Newsinfo> getNewsinfoByConditionAndPage(Newsinfo condition, int curPage, int pageSize) {
		// TODO Auto-generated method stub
		return newsinfoDAO.getNewsinfoByConditionAndPage(condition, curPage, pageSize);
	}

	@Override
	public Integer getCountOfNewsinfoByCondition(Newsinfo condition) {
		// TODO Auto-generated method stub
		return newsinfoDAO.getCountOfNewsinfoByCondition(condition);
	}

	@Override
	public Pager getPagerOfNewsinfo(int pageSize) {
		// TODO Auto-generated method stub
		
		Pager pager =  new Pager();
		pager.setPageSize(pageSize);
		int count = newsinfoDAO.getCountOfAllNewsinfo();
		pager.setRowCount(count);
		
		return pager;
	}

	@Override
	public Pager getPagerOfNewsinfoByCondition(Newsinfo condition, int pageSize) {
		// TODO Auto-generated method stub
		Pager pager = new Pager();
		pager.setPageSize(pageSize);
		int rowCount = newsinfoDAO.getCountOfNewsinfoByCondition(condition);
		pager.setRowCount(rowCount);
		
		return pager;
	}

	@Override
	public List<Newsinfo> getNewsinfoByTopicType(Integer id) {
		// TODO Auto-generated method stub
		return newsinfoDAO.getNewsinfoByTopicType(id);
	}

	@Override
	public Newsinfo getNewsinfoById(Integer id) {
		// TODO Auto-generated method stub
		return newsinfoDAO.getNewsinfoById(id);
	}

	@Override
	public boolean saveNewsinfo(Newsinfo newsinfo) {
		// TODO Auto-generated method stub
		return newsinfoDAO.saveNewsinfo(newsinfo);
	}

	@Override
	public boolean updateNewsinfo(Newsinfo newsinfo) {
		// TODO Auto-generated method stub
		return newsinfoDAO.updateNewsinfo(newsinfo);
	}

	@Override
	public boolean deleteNewsinfo(Newsinfo newsinfo) {
		// TODO Auto-generated method stub
		return newsinfoDAO.deleteNewsinfo(newsinfo);
	}

}
